package com.lzhsite.technology.designPattern.strategy.GuessDemo;

public class Player
{
    private String playerName;
    private IGuessType currentType;
    private int winCount;
    private int loseCount;
    private int playCount;

    public Player(String playerName, IGuessType currentType)
    {
        this.playerName = playerName;
        this.currentType = currentType;
    }

    public Hand nextHand()
    {
        return currentType.nextHand();
    }

    public void win()
    {
        currentType.whetherWin(true);
        winCount++;
        playCount++;
    }

    public void lose()
    {
        currentType.whetherWin(false);
        loseCount++;
        playCount++;
    }

    public void draw()
    {
        playCount++;
    }

    public String toString()
    {
        return "[" + playerName + ": " + playCount + " Games, " + winCount + " Win, " + loseCount + " Lose]";
    }
}
